<?php

	include("connectDB.php");
	
	#GET POSTED DATA:
	$number = $_POST['number'];
	$lat = $_POST['latitude'];;
	$long = $_POST['longitude'];
	
	$result = mysql_query("UPDATE users SET latitude=" . $lat . ", longitude=" . $long . ", timestamp=DATE_ADD(NOW(),INTERVAL 8 HOUR) WHERE user=" . $number . ")";
	
	if (mysql_affected_rows()==0) {
		$result = mysql_query("INSERT INTO users VALUES (" . $number ."," . $lat . "," . $long . ", DATE_ADD(NOW(),INTERVAL 8 HOUR))");
	}
?>